<PageHeader as |p|>
  <p.top>
    <KeyValueHeader @baseKey={{key}} @path="vault.cluster.secrets.backend.list" @mode={{mode}} @root={{root}} @showCurrent={{true}} />
  </p.top>
  <p.levelLeft>
    <h1 class="title is-3">
      {{#if (eq mode "create") }}
        Create encryption key
      {{else if (eq mode "edit") }}
        Edit encryption key
      {{else}}
        Encryption key <code>{{key.id}}</code>
      {{/if}}
    </h1>
  </p.levelLeft>
</PageHeader>
{{#if (eq mode "create")}}
  <TransitFormCreate
    @createOrUpdateKey={{action "createOrUpdateKey" mode}}
    @setValueOnKey={{action "setValueOnKey" "exportable"}}
    @derivedChange={{action "derivedChange" value="target.checked"}}
    @convergentEncryptionChange={{action "convergentEncryptionChange" value="target.checked"}}
    @key={{key}}
    @requestInFlight={{requestInFlight}}
  />
{{else if (eq mode "edit")}}
  <TransitFormEdit
    @createOrUpdateKey={{action "createOrUpdateKey" mode}}
    @setValueOnKey={{action "setValueOnKey" "deletionAllowed"}}
    @deleteKey={{action "deleteKey"}}
    @key={{key}}
    @requestInFlight={{requestInFlight}}
    @capabilities={{capabilities}}
  />
{{else if (eq mode "show")}}
  <TransitFormShow
    @refresh={{action "refresh"}}
    @tab={{tab}}
    @key={{key}}
    @capabilities={{capabilities}}
    @mode={{mode}}
    @model={{model}}
    @backend={{backend}}
  />
{{else}}
  <EmptyState
    @title="No Transit mode selected"
  />
{{/if}}

